package net.xdclasss.demo_project.controller;

import net.xdclasss.demo_project.domain.Video;
import net.xdclasss.demo_project.service.VideoService;
import net.xdclasss.demo_project.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 视频控制器
 */

@RestController
@RequestMapping("/api/v1/pub/video")
public class VideoController {
    @Autowired
    private VideoService videoService;
    // @RequestMapping("list")
    @GetMapping("list")
    public JsonData list(){
        // int i = 1/0;
        List<Video> list = videoService.list();
        return JsonData.buildSuccess(list);

    }
    @PostMapping("save_video_chapter")
    public JsonData saveVideoChapter(@RequestBody Video video){
        System.out.println(video.toString());
        return JsonData.buildSuccess(video);
    }
}
